//
//  UIBarButtonItem+ZTExtension.m
//  项目练习
//
//  Created by 张江涛 on 15/12/1.
//  Copyright © 2015年 张江涛. All rights reserved.
//

#import "UIBarButtonItem+ZTExtension.h"

@implementation UIBarButtonItem (ZTExtension)

+ (UIBarButtonItem *)itemWithImage: (NSString *)image highImage:(NSString *)hightImage traget:(id)traget action:(SEL)action
{
    UIButton  *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:hightImage] forState:UIControlStateHighlighted];
    [button sizeToFit];
    [button addTarget:traget action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[UIBarButtonItem alloc]initWithCustomView:button];
}
@end
